package profile

import (
	"encoding/json"
	"io"
	"os"
)

const ConfigStr = "conf/Config.json"
const StepStr = "conf/Step.json"

// LoadProfiles 加载配置
func LoadProfiles() {
	loadConfig()

	loadStep()
}

func loadStep() {
	file, _ := os.Open(StepStr)
	bytes, _ := io.ReadAll(file)
	var steps []Step
	json.Unmarshal(bytes, &steps)
	Steps = &steps
}

func loadConfig() {
	confFile, _ := os.Open(ConfigStr)
	confBytes, _ := io.ReadAll(confFile)
	var conf Config
	json.Unmarshal(confBytes, &conf)
	AppConfigSet = &conf
}
